package com.flyfinger.pojo;

import com.flyfinger.codec.impl.JSONSerializer;

import java.io.IOException;

/**
 * @author zhouyp
 * @program code
 * @description 服务的位置
 * @create 2020-06-22
 */
public class ServiceLocation {

	private String ip;
	private int port;
	private long replyTime;

	public long getReplyTime() {
		return replyTime;
	}

	public void setReplyTime(long replyTime) {
		this.replyTime = replyTime;
	}

	public ServiceLocation() {
	}

	public ServiceLocation(String ip, int port) {
		this.ip = ip;
		this.port = port;
	}

	public byte[] writeAsBytes() throws IOException {
		return JSONSerializer.getInstance().serialize(this);
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}

	@Override
	public String toString() {
		return "ServiceLocation{" +
				"ip='" + ip + '\'' +
				", port=" + port +
				'}';
	}
}
